package com.zhkeshe.keshe.controller;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.JSONPObject;
import com.zhkeshe.keshe.Service.UserService;
import com.zhkeshe.keshe.entity.CommonResult;
import com.zhkeshe.keshe.entity.Device;
import com.zhkeshe.keshe.entity.User;
import com.zhkeshe.keshe.entity.UserDevice;
import com.zhkeshe.keshe.mapper.DeviceMapper;
import com.zhkeshe.keshe.mapper.UserDeviceMapper;
import com.zhkeshe.keshe.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@CrossOrigin
@RestController
public class UserController {

    @Autowired
    private UserService userService;
    @RequestMapping("/User/Login")
    Object Login(@RequestBody Map<String,String> data) {
        System.out.println(data.toString());
        return userService.loginService(data);
    }

    @RequestMapping("/User/VerifyUser")
    Object VerifyUser(@RequestBody Map<String,String> data){
        System.out.println(data);
        CommonResult commonResult=new CommonResult();
        commonResult.setStatus(true);
        commonResult.setMessage("verify??");
        commonResult.setDeviceList(new ArrayList<>());
        return commonResult;
    }
    @RequestMapping("/User")
    Object User(@RequestBody Map<String,String> data){
        return userService.register(data);
    }

}
